<?php 
include_once("../service/User.php");
include_once("Controller.php");
class ControllerUser extends Controller implements IController 
{
  //controller
  const ctl="User";
  /*
  public static function init()
  {
   $ctl = empty($_GET['ctl'])?"":$_GET['ctl'];
   if(trim($ctl)!=ControllerUser::ctl)
   {
      throw new Exception("Controller name error");
    }
    else 
    new ControllerUser();
  }
  private function __construct()
  {
    $ac = empty($_GET['ac'])?"":$_GET['ac'];
    if($ac=="login")$this->login();
  }
  */
  public function login()
  {
    $name = empty($_POST['name'])?"":$_POST['name'];
    $pwd = empty($_POST['pwd'])?"":$_POST['pwd'];
    echo (new ServiceUser())->loginByNameAndPwd($name,$pwd);
  }
  public function handleAction()
  {
    
  }
}
?>